<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<?php $title = '商务通名片'; ?>
<head>
	<meta charset="UTF-8">
	<title><?php echo ($title); ?></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<link rel="stylesheet" href="/Application/Home/View//Public/static/css/weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/jquery-weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/custom.css"/>
    <style type="text/css">
		body{
			background:#f1f1f1;
			color:#a3a3a3;
			font-family:"Microsoft YaHei";
		}
		.bd{
			padding:20px;
		}
        li{list-style: none;}
		p{
			font-size: 13px;
		}
		.weui-cell_select-before .weui-cell__hd:before{
			border-width: 0px 2px 2px 0;
			margin-top: -6px;
		}
		.weui-cell_select-before .weui-cell__hd:after{border:none;}
        .sstmb {
            padding-bottom: 60px;
        }
        .foot-ul{
			text-align:center;
			margin-top: 1rem;
			padding:10px;
			background: #22a9fe;
			opacity: 0.9;
		}
		.foot-ul a{
			color: #fff;
		}
		.foot-ul a img{
			max-width: 24px;
		}
		.pinglun{
			padding: 0 2px;
			background: #ff5959;
			border-radius: 50px;
			color: #fff;
			position: absolute;
			top:-6px;
			left:73px;
			font-size: 13px;
		}
		
		
		.weui-cell__bd p{
		color:#6b6969;
		}
        
	</style>
</head>

<body ontouchstart>

<script type="text/javascript">
/*   
   var useragent = navigator.userAgent;
    if (useragent.match(/MicroMessenger/i) != 'MicroMessenger') {
        location.href='<?php echo U("login/forbidden");?>';
    }
    */
</script>
<style type="text/css">
		.weui-cell:before{right:15px;}
		body{
			background:#f8f8f8;
			color:#3b3b3b;
			font-family:"Microsoft YaHei";
		}
		
		.clearfloat:after{
			display: block;
			content: '';
			clear: both;
			height: 0;
			overflow: hidden;
		}
		.card_top{
			background-image:url(.//Application/Home/View//Public/static/images/card1.jpg);
			position:absolute;
			top:4%;
			margin:0 4%;
			height:9.4rem;
			background-size:cover;
			background-repeat:no-repeat;
			background-position:center;
			width:92%;
			border-radius:.3rem;
			 box-shadow: 2px 2px 5px #cccccc;
		}
		.card_top1{
			width:100%;
			height:9.4rem;
			
		}
		.top-img{
			width:4.6rem;
			border-radius: 80px;
		}
		.top-name{
			position: absolute;
			top:1rem;
			left:43%;
			overflow: hidden;
			width:55%;
		}
		.top-name p{
			font-size: 15px;
		}
		.card_top2{
			position: absolute;
			top:5.5rem;
			left: 6%;
			width: 94%;
		}
		.card_top2 >p{
			width:87%;
			border-bottom: 1px solid #e9e9e9;
			padding:.3rem 0;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
		}
		.card_top2 span{
			color: #22a9fe;
			font-size: 13px;
		}
		.card-one{
			margin-top: .5rem;
			padding:0 4%;
		}
		.weui-btn{
			font-size:13px;
			background:#22a9fe;
			padding:3px;
		}
		.demos-content-padded {
			margin-top:3rem;
			width:4rem;
			border-radius:20px;
			padding: 0 2px;
		}
		.card-content{
			padding:0 5%;
			margin-top: .6rem;
		}
		.weui-flex__item img{
			max-width: 100%;
		}
		.weui-flex__item p{
			font-size: 13px;
		}
		.card-foot p{
			padding:10px 10px;
			border:1px solid #ededed;
			background: #ededed;
			margin:0 5px;
			border-radius: 8px;
		}
		.card-foot li{
			float:left;
			position:relative;
			width:4.5rem;
			margin-left: 5px;
		}
		.weui-cells:before,.weui-cells:after{border:0;}
		#phone a{color:#22a9fe;}
        .serviceitem{width:25%;float:left;color:gray;}
        .serviceitem img{max-width:85%;border-radius:5px;}
        .serviceitem p{overflow:hidden;white-space:nowrap; text-overflow:ellipsis; }
        #address{width:55%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;display:inline-block;}
        #share{position:fixed;width:50px;height:50px;text-align:center;right:2%;bottom:140px;}
        #topmove{position:fixed;width:50px;height:50px;text-align:center;right:2%;bottom:80px;}
		
		.weui-photo-browser-modal .photo-container img{width:100%;}
        
        .ppop{
           position: absolute;
            z-index: 10000;
            top: 20%;
            display: none;
            overflow: hidden;
            width: 270px;
            text-align: center;
            background:#F5F5F6;
            color: #000;
            border-radius: 13px;
            padding-top: 20px;
        }
        .mui-popup-buttons {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    height: 44px;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}

.mui-popup-button {
    font-size: 17px;
    line-height: 44px;
    position: relative;
    display: block;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    padding: 0 5px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #007aff;
    background: rgba(255,255,255,.95);
    -webkit-box-flex: 1;
}

.mui-popup-button:first-child:last-child {
    border-radius: 0 0 13px 13px;
}

.mui-popup-button.mui-popup-button-bold {
    font-weight: 600;
}
	</style>
    <div class="container js_container">

    </div>
<div class="page">
<div style="background:#018cd6;height:8rem;width:100%;"></div>
<div class="card_top">
	<div class="card_top1">
		<div style="position: absolute;top:.6rem;left: 8%;">
			<img  class="top-img" src="/uploads/<?php echo ($row["avatar"]); ?>" id='avatar' />
		</div>
		<div class="top-name">
			<h3><span id='true_name'><?php echo ($row["true_name"]); ?></span><small style="font-weight:normal;font-size:13px" id='position'>&nbsp;<?php echo ($row["position"]); ?></small><img style="vertical-align:middle;margin-left: 1rem;width:8%;" src="/Application/Home/View//Public/static/images/v.png"/></h3>
			<p id='company_name'><?php echo ($row["company_name"]); ?></p>
			<p id='tags' style="font-size:14px;color:#8e8e8e;"><?php echo ($row["pos_tags"]); ?></p>
		</div>
	<div class="card_top2">
		<p>
			<img style="vertical-align: middle;width:.8rem;margin-right:.7rem; margin-bottom: .2rem;" src="/Application/Home/View//Public/static/images/p.jpg"/><span id="phone" style="font-size:16px;margin-b"><a href="tel:<?php echo ($row["telephone"]); ?>" ><?php echo ($row["telephone"]); ?></a></span>
		</p>
		<p  style="border:0px">
			<img style="vertical-align: middle;width:.8rem;margin-right: .7rem; margin-bottom: .2rem;" src="/Application/Home/View//Public/static/images/p.png"/><span id="address"><?php echo ($row["address"]); ?></span> <span style="position: absolute;right: 13%;" onclick="window.open('https://m.amap.com/search/mapview/keywords=<?php echo ($row["address"]); ?>&cluster_state=5&pagenum=1')">显示地图</span>
		</p>
	</div>

	
	</div>
</div>
<div class="card-one clearfloat weui-flex">
 	<div  class='demos-content-padded weui-flex__item'>
      <a  href="#cbrief" class="weui-btn weui-flex__item ">公司介绍</a>
	</div>
	<div  class='demos-content-padded weui-flex__item'>
      <a  href="#serviceitem" class="weui-btn weui-flex__item ">服务内容</a>
	</div>
	<div  class='demos-content-padded weui-flex__item'>
      <a  href="#brief" class="weui-btn weui-flex__item ">个人简介</a>
	</div>
	<div  class='demos-content-padded weui-flex__item'>
      <a  href="tel:<?php echo ($row["telephone"]); ?>" class="weui-btn weui-flex__item ">联系电话</a>
	</div>
</div>
<p style="padding:.4rem 5%;background: #ededed;margin-top:1rem;font-size: 13px;"><a name="cbrief"></a>公司介绍</p>
<div class="card-content">
	<p><?php echo (fmt_text($row["company_brief"])); ?> </p>
    <?php if(is_array($company_brief_images)): foreach($company_brief_images as $key=>$vo): if($vo != ""): ?><p align=center><Img src='/uploads/<?php echo ($vo); ?>' style="max-width:100%;" class='cimg' /></p><?php endif; endforeach; endif; ?>
</div>
<p style="padding:.4rem 5%;background: #ededed;margin-top:1rem;font-size: 13px;"><a name="serviceitem"></a>服务内容</p>
<div style="text-align: center;margin-top: 1rem;" class="card-content ">
	<ul>
       <?php if(is_array($srow)): $i = 0; $__LIST__ = $srow;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo["icon"] == ""): ?><li class='serviceitem' onclick="show_service_item(<?php echo ($vo["id"]); ?>)"><img src="/Application/Home/View//Public/static/images/default.png" ><p><?php echo ($vo["title"]); ?></p></li>
        <?php else: ?>
		<li class='serviceitem' onclick="show_service_item(<?php echo ($vo["id"]); ?>)"><img src="/uploads/<?php echo ($vo["icon"]); ?>" ><p><?php echo ($vo["title"]); ?></p></li><?php endif; endforeach; endif; else: echo "" ;endif; ?>
	</ul>
	<div style="clear:both;"></div>
</div>

<p style="padding:.4rem 5%;background: #ededed;margin-top:1rem;font-size: 13px;"><a name="brief"></a>个人简介</p>
<div class="card-content">
	<p><?php echo (fmt_text($row["brief"])); ?> </p>
    <?php if(is_array($brief_images)): foreach($brief_images as $key=>$vo): if($vo != ""): ?><p align=center><Img src='/uploads/<?php echo ($vo); ?>' style="max-width:100%;" /></p><?php endif; endforeach; endif; ?>
</div>
<p class="clearfloat" style="padding:.4rem 5%;background: #ededed;margin-top:1rem;font-size: 13px;">加我微信/二维码</p>
<div class="card-content">
	<p align=center><img src='/uploads/<?php echo ($row["wechat_qrcode"]); ?>' style='max-width:80%;border: #e0e0e0 solid 6px;margin-top: 10px;'/></p>
</div>
<br>



  <p class="clearfloat" style="color: #dedede;    font-weight: bold;    text-align: center;">长沙石开网络科技 @ 版权所有</p>
</div>

 <div id="show_s_info" style="display:none;">
    <div style="padding:5px;">
       <div align=right onclick="layer.closeAll();"><img src="/Application/Home/View//Public/static/images/close.png"/></div>
       <div id="title" style="font-weight:bold;margin:10px 0;"></div>
       <div id="content"></div>
       <div id="imgs" align="center"></div>
    </div>
</div> 

<div id="topmove" onclick='topmove()'>
   <img src="/Application/Home/View//Public/static/images/topmove.png"/>
</div>

<div class='ppop'>
    <p>长按二维码保存到手机通讯录</p>
    <div id='code' align="center">
      
    </div>
    <div class="mui-popup-buttons">
        <span class="mui-popup-button mui-popup-button-bold" onclick='close_code()'>关闭</span>
    </div>
</div>

<!--显示分享按钮
<div id="share" onclick='share()'>
   <img src="/Application/Home/View//Public/static/images/share.png"/>
</div>  -->

<div style="height: 100%; width: 100%;z-index:3; top: 0px;display:none; left: 0px; position: absolute; text-align: right; background: rgba(0, 0, 0, 0.701961);" id='pmask'>
  
</div>

<div style="height: 100%; width: 100%;z-index:3; top: 0px;display:none; left: 0px; position: absolute; text-align: right; background: rgba(0, 0, 0, 0.701961);" id="mask" onclick="h_mask()">
  <img src="/Application/Home/View//Public/static/images/top_share.png">
</div>
<div class="sstmb"></div>
<div class="foot-ul" style="position:fixed;bottom:0;width:100%;">
	<ul class="weui-flex ">
		<a class="weui-flex__item " href="<?php echo U('Card/index');?>&userid=<?php echo (session('userid')); ?>"><li ><img src="/Application/Home/View//Public/static/images/foot (1).png"><p style="line-height: 10px;">我的名片</p></li></a>
        
        <?php if($_SESSION['userid']!= ""): ?><a class="weui-flex__item " href="<?php echo U('index/card_edit');?>"><li ><img src="/Application/Home/View//Public/static/images/foot (3).png"><p style="line-height: 10px;">制作名片</p></li></a>
		<?php else: ?>
            <a class="weui-flex__item " href="<?php echo U('login/register');?>&tid=<?php echo ($tid); ?>"><li ><img src="/Application/Home/View//Public/static/images/foot (3).png"><p style="line-height: 10px;">制作名片</p></li></a><?php endif; ?>
      <!--  <a class="weui-flex__item " href="<?php echo U('index/cards');?>"><li ><img src="/Application/Home/View//Public/static/images/foot (2).png"><p style="line-height: 10px;">名片夹</p></li></a> -->
      
       <a class="weui-flex__item " onclick="gen_qrcode('<?php echo ($row["true_name"]); ?>', '<?php echo ($row["telephone"]); ?>', '<?php echo ($row["email"]); ?>', '<?php echo ($row["company_name"]); ?>','<?php echo ($row["profession"]); ?>','<?php echo ($row["position"]); ?>','<?php echo ($row["qq"]); ?>', '<?php echo ($row["address"]); ?>');"><li ><img src="/Application/Home/View//Public/static/images/foot (2).png"><p style="line-height: 10px;">存入通迅录</p></li></a>
      
       
		<a class="weui-flex__item " href="<?php echo U('index/more');?>"><li ><img src="/Application/Home/View//Public/static/images/foot (4).png"><p style="line-height: 10px;">更多</p></li></a>
	</ul>
</div>

       <script src="/Application/Home/View//Public/static/js/jquery-2.1.4.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery-weui.min.js"></script>
    <script src="/Application/Home/View//Public/static/js/fastclick.js"></script>
    <script src="/Application/Home/View//Public/static/layer/layer.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery.form.js"></script>
    <script>
      $(function() {
        FastClick.attach(document.body);
      });
    </script>
</body>
</html>
   <script type='text/javascript' src='/Application/Home/View//Public/static/js/swiper.js' charset='utf-8'></script>
   <script type='text/javascript' src='/Application/Home/View//Public/static/js/jquery.qrcode.min.js' charset='utf-8'></script>
   <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
   <script>
     function toUtf8(str) {    
        var out, i, len, c;    
        out = "";    
        len = str.length;    
        for(i = 0; i < len; i++) {    
            c = str.charCodeAt(i);    
            if ((c >= 0x0001) && (c <= 0x007F)) {    
                out += str.charAt(i);    
            } else if (c > 0x07FF) {    
                out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));    
                out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));    
                out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));    
            } else {    
                out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));    
                out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));    
            }    
        }    
        return out;    
    }
   
     function convertCanvasToImage(canvas) {
        var image = new Image();
        image.src = canvas.toDataURL("image/png");
        return image;
    }
   
     function gen_qrcode(true_name, telephone, email, company_name, profession, position, qq, address){
     
         var content = 'BEGIN:VCARD\r\nVERSION:3.0\r\nFN:'+true_name+'\r\nTEL:'+telephone+'\r\nEMAIL:'+email+'\r\n';
         content += 'ORG:'+company_name+'\r\nROLE:'+profession+'\r\nTITLE:'+position+'\r\nX-QQ:'+qq+'\r\nURL:'+location.href+'\r\nADR:'+address+'\r\nEND:VCARD';
         var str = toUtf8(content); 
         
         $("#code").empty();
         $("#code").qrcode({ 
            width: 230,
            height:230,
            text: str
        }); 
        
        var mycanvas1=document.getElementsByTagName('canvas')[0];
        var img=convertCanvasToImage(mycanvas1);
        $("#code").empty();
        $('#code').append(img);
        $("#pmask").show();
        $(".ppop").css('left', $(document).width()/2-$('.ppop').width()/2);
        $(".ppop").show();
     }
     
     function close_code(){
         $("#pmask").hide();
         $(".ppop").hide();
     } 
   
     $(function(){
	     var itm = [];
		 for(var i=0; i<$(".cimg").length; i++){
		    itm.push($(".cimg").eq(i).attr("src"));
		 }
	     var pb1 = $.photoBrowser({
			  items: itm
		 });
		 
		 $(".cimg").bind('click', function(){
		     pb1.open();
		 })
		 //初始化分享
		 init_share();
	 })
   
     function toggle(){
         var type = $("#phone").attr("data-type");
         if(type == 0){
             $("#phone").attr("data-type", 1);
             $("#phone").html($("#phone").attr("data-yes"));
             $("#sho_ctl").html('隐藏号码');
         }else{
             $("#phone").attr("data-type", 0);
             $("#phone").html($("#phone").attr("data-no"));
             $("#sho_ctl").html('显示号码');
         }
     }
     
     function show_service_item(id){
         var index = layer.open({type: 2});
         var t = Math.random();
         $.ajax({
            url:'<?php echo U("Card/get_s_info");?>',
            data:{"id":id, "t":t},
            type:"POST",
            success:function(data){
                
                var data = JSON.parse(data);
                $("#title").html(data.title)
                $("#content").html(data.content)
                $("#imgs").html('');
                if(data.images){
                    for(var i=0;i < data.images.split(",").length;i++){
                       if(data.images.split(",")[i]){
                        $("#imgs").append("<img src='/uploads/"+data.images.split(",")[i]+"' style='max-width:100%;' />");
                       }
                    }
                }
                
                setTimeout(function(){
                  layer.close(index);
                    layer.open({
                  type: 1
                  ,content: $("#show_s_info").html()
                  ,anim: 'up'
                  ,style: 'position:fixed; left:0; top:0; width:100%; height:100%; overflow:scroll; -webkit-animation-duration: .5s; animation-duration: .5s;'
                });
                }, 500);
            }
         })
         
     }
     
     function topmove(){
     (function smoothscroll(){
    var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
    if (currentScroll > 0) {
         window.requestAnimationFrame(smoothscroll);
         window.scrollTo (0,currentScroll - (currentScroll/5));
    }
})();
     }
     
     function show_all(obj){
         $(obj).prev().removeAttr('style');
     }
	 
	 function share(){
	     $(window).scrollTop(0);
		 $("#mask").show();
	 }

    function init_share(){
        $.ajax({
           url:'<?php echo U("Card/get_signpackage");?>',
           data:{"url":location.href},
		   type:"POST",
           success:function(data){
               set_share_info(data);
			   
           }
        })
        
    }
    
    function h_mask(){
        $("#mask").hide();
    }
	
	function set_share_info(signPackage){
		var signPackage = JSON.parse(signPackage);
		wx.config({
			debug: false, 
			appId: signPackage.appId,
			timestamp:signPackage.timestamp,
			nonceStr:signPackage.nonceStr,
			signature: signPackage.signature,
			jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage','hideMenuItems'] 
		});
		  var title=$("#true_name").text()+"的商务通名片，互联网营销神器", imgUrl="http://"+location.hostname+$("#avatar").attr('src'), desc=$("#company_name").text()+'('+$("#position").text()+')'+"\n"+$("#tags").text();
		  
		  wx.ready(function() {
		     wx.hideMenuItems({
				menuList: ['menuItem:share:qq', 'menuItem:share:weiboApp', 'menuItem:favorite',]
			});
		    
            wx.onMenuShareTimeline({
                title: title,
                link: location.href,
                imgUrl: imgUrl,
                success: function () { 
                 //   $.alert('分享成功!');
                },
                cancel: function () { 
               //    $.alert('取消分享!');
                }

            });
            
			wx.onMenuShareAppMessage({
				title: title,
				desc: desc,
				link: location.href,
				imgUrl: imgUrl,
				type: '', 
				dataUrl: '', 
				success: function () {
			//	    $.alert('分享成功!');
				},
				cancel: function () {
			//	    $.alert('取消分享!');
				}
			});
		});
	}
   </script>